﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="cn_online_message" Codebehind="online_message.aspx.cs" %>


<%@ Register Src="~/cn/UserControl/header.ascx" TagName="header" TagPrefix="uc1" %>
<%@ Register Src="~/cn/UserControl/top_ad.ascx" TagName="top_ad" TagPrefix="uc2" %>
<%@ Register Src="~/cn/UserControl/channel_navigation.ascx" TagName="channel_navigation"
    TagPrefix="uc3" %>
<%@ Register Src="~/cn/UserControl/bottom_ad.ascx" TagName="bottom_ad" TagPrefix="uc4" %>
<%@ Register Src="~/cn/UserControl/footer.ascx" TagName="footer" TagPrefix="uc5" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>在线留言，<%=(new Gift.WebApp.BasicSet()).TitleBind() %></title>
    <meta name="Keywords" content="在线留言，<%=(new Gift.WebApp.BasicSet()).KeywordBind() %>" />
    <meta name="Description" content="在线留言，<%=(new Gift.WebApp.BasicSet()).DescriptionBind() %>" />
    <link href="/script/css/layout.css"
        type="text/css" rel="stylesheet" />

    <script language="Javascript" type="text/javascript" src="/script/js/jquery-1.6.2.min.js"></script>




    <script type="text/javascript">
        $(function () {
            $("#btnOnlineMessageSubmit").click(function () {
                if ($("#txtTitle").val() == "") {
                    $("#txtTitle").focus();
                    $("#spTitle").html("<img src=\"/script/images/wrong.gif\" />请输入标题！");
                    return false;
                } else {
                    $("#spTitle").html("<img src=\"/script/images/right.gif\" />");
                }
                if ($("#txtaContent").val() == "") {
                    $("#txtaContent").select();
                    $("#spContent").html("<img src=\"/script/images/wrong.gif\" />请输入内容！");
                    return false;
                } else {
                    if ($("#txtaContent").val().length > 500) {
                        $("#txtaContent").select();
                        $("#spContent").html("<img src=\"/script/images/wrong.gif\" />内容不能超过500个字符！");
                        return false;
                    } else $("#spContent").html("<img src=\"/script/images/right.gif\" />");
                }
                if ($("#txtOnlineMessageCode").val() == "") {
                    $("#txtOnlineMessageCode").select();
                    $("#spOnlineMessageCode").html("<img src=\"/script/images/wrong.gif\" />请输入验证码！");
                    return false;
                } else $("#spOnlineMessageCode").html("<img src=\"/script/images/right.gif\" />");
                $.ajax({
                    type: "POST",
                    url: "onlineMessageHandler.ashx",
                    data: "title=" + escape($("#txtTitle").val()) + "&contact=" + escape($("#txtContact").val()) + "&content=" + escape($("#txtaContent").val()) + "&code=" + $("#txtOnlineMessageCode").val(),
                    success: function (msg) {
                        if (msg == "0") {
                            $("#txtOnlineMessageCode").select();
                            $("#spOnlineMessageCode").html("<img src=\"/script/images/wrong.gif\" />验证码错误，请重新输入！");
                            $("#imgOnlineMessageCheckCode").attr("src", "/code.aspx?a=" + Math.random() + "&t=onlineMessage");
                        } else if (msg == "1") {
                            art.dialog.tips("恭喜您，发布成功！", 1.5);
                            setTimeout("location.reload()", 2000);
                        } else art.dialog.tips("很抱歉，发布失败！", 1.5);
                    }
                });
                return false;
            });
        });
    </script>

</head>
<body>
    <uc1:header ID="Header1" runat="server" />
    <uc2:top_ad ID="Top_ad1" runat="server" />
    <div class="container message">
        <div class="tab-content comment_pages">
            <!--<h1>在线留言</h1>-->
            <div class="comment_title ">
                <a href="#comment">我要留言</a><span>在线留言</span>
            </div>
            <%Response.Write(OnlineMessageBind()); %>
            <span class="clear"></span><a name="comment"></a>
            <h3>
                发表留言：</h3>
            <div class="tabcontain comment_list">
                <form id="formOnlineMessage" action="" defaultbutton="btnOnlineMessageSubmit">
                    <p>
                        <label for="txtTitle">
                            标题：</label><input type="text" id="txtTitle" maxlength="50" /><span id="spTitle">*最多可输入50个字符</span></p>
                    <p>
                        <label for="txtaContent">
                            留言内容：</label><textarea cols="20" rows="20" id="txtaContent"></textarea><span id="spContent">*最多可输入500个字字符</span></p>
                    <p>
                        <label for="txtContact">
                            联系方式：</label><input type="text" id="txtContact" maxlength="50" /></p>
                    <label for="txtOnlineMessageCode">
                            验证码：</label><input id="txtOnlineMessageCode" type="text" maxlength="4" class="txtCode" /><img id="imgOnlineMessageCheckCode"
                                src="/code.aspx?t=onlineMessage" alt="看不清楚,换一张" onclick="this.src = '/code.aspx?a=' + Math.random();+'&t=onlineMessage'"
                                class="imgCode" /><span id="spOnlineMessageCode">*</span>
                    <p><input id="btnOnlineMessageSubmit" class="submit" type="submit" value="提  交" /></p>
                </form>
            </div>
        </div>
        <span class="clear"></span>
    </div>
    <uc5:footer ID="Footer1" runat="server" />
</body>
</html>

